<template>
   <el-container class="layout-container-demo">
    <menuN :width="width" :collapse="collapse"></menuN>
    <el-container>
      <el-header style="display: flex;justify-content: space-between; font-size: 12px">
        <el-icon :size="20" @click="collapse=!collapse">
            <Expand v-if="collapse"></Expand>
            <Fold v-else></Fold>
          </el-icon>
        <el-dropdown @command="quit">
          <span class="el-dropdown-link">
            你好：admin
            <el-icon class="el-icon--right">
              <arrow-down />
            </el-icon>
          </span>
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item command="a">关于</el-dropdown-item>
              <el-dropdown-item command="q">退出</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </el-header>
      <el-main>
        <RouterView></RouterView>
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup lang="ts">
import { Menu as IconMenu, Message, Setting} from '@element-plus/icons-vue'
import { ArrowDown} from '@element-plus/icons-vue'
import { ElMessage} from 'element-plus'
import { Expand,Fold } from '@element-plus/icons-vue'
import menuN from "@/components/menu.vue"
import {ref,computed} from "vue"
import {useCounterStore} from "@/stores/counter"
import { useRouter } from 'vue-router'
let router = useRouter()
let collapse = ref(false)
let store = useCounterStore()
const userInfo:any = computed(()=>{
  return store.userInfo
})
const width:any = computed(()=>{
  return !collapse.value ?"200px":"50px"
})
const quit = (str:any)=>{
  switch (str) {
        case "a":
          ElMessage({
            message: "暂不处理",
            type: 'warning',
          })
          break
        case "q":
          localStorage.removeItem("token")
          router.push("/login")
          break
        default: break
      }
}
</script>

<style scoped>
html,
body,
#app {
  height: 100%;
}

.el-container {
  height: 100%;
}
</style>
